package xupt.se.ttms.service;

import java.sql.ResultSet;
import java.util.List;

import xupt.se.ttms.idao.DAOFactory;
import xupt.se.ttms.idao.iSeatDAO;
import xupt.se.ttms.model.Seat;

public class SeatSrv {
	private iSeatDAO seatDAO=DAOFactory.creatSeatDAO();
	public boolean add(Seat seat) throws Exception{
		
		return seatDAO.execInsert(seat);
	}
	
	public boolean modify(Seat seat) throws Exception{
		return seatDAO.execUpdate(seat);	
	}
	
	public boolean delete(int ID) throws Exception{
		return seatDAO.execDelete(ID);		
	}
	
	public List<Seat> Fetch(int seat_id) throws Exception{
		ResultSet resultSet=seatDAO.execQuery(seat_id);	
		return seatDAO.HandleSeatResultSet(resultSet);	
	}
	
	public List<Seat> FetchAll() throws Exception{
		ResultSet resultSet=seatDAO.exexQueryAll();
		return seatDAO.HandleSeatResultSet(resultSet);		
	}
	public List<Seat> FetchStudio_id(int studio_id) throws Exception
	{
		ResultSet resultSet=seatDAO.execStudio_id(studio_id);
		return seatDAO.HandleSeatResultSet(resultSet);	
	}
	public List<Seat> Fetch(String state ) throws Exception{
		ResultSet resultSet=seatDAO.execQuery(state);	
		return seatDAO.HandleSeatResultSet(resultSet);	
	}
	public boolean init(int studio_id) throws Exception{
		return seatDAO.execInit(studio_id);	
	}
	public boolean deleteAll() throws Exception{
		return seatDAO.execDeleteAll();		
	}

	public List<Seat> FetchSeat(int studio_id,int row,int col) throws Exception{
		ResultSet resultSet=seatDAO.execQuery(studio_id, row, col);	
		return seatDAO.HandleSeatResultSet(resultSet);	
	}
}
